import request from '@/utils/request'
/**
 * 获取日志
 * @param query
 */
export function getLog(query) {
  return request({
    url: '/api/Administrator/getLog',
    method: 'GET',
    params: query
  })
}

/**
 * 新增
 * @param data
 */
export function addAdmin(data) {
  return request({
    method: 'POST',
    url: '/api/Administrator/addAdmin',
    data
  })
}
/**
 * 查询角色
 * @param query
 */
export function getList(query) {
  return request({
    url: '/api/Administrator/getList',
    method: 'GET',
    params: query
  })
}

/**
 * 禁用 or 启用
 * @param id
 */
export function freeze(id, status) {
  const data = { status: status }
  return request({
    method: 'PUT',
    url: '/api/Administrator/changeStatus/' + id,
    data
  })
}

/**
 * 改变角色
 * @param id
 * @param status
 */
export function editRole(data) {
  return request({
    method: 'PUT',
    url: '/api/Administrator/roles/' + data.id,
    data
  })
}
/**
 * 删除
 * @param id
 */
export function delAdmin(id) {
  return request({
    method: 'DELETE',
    url: '/api/Administrator/delAdmin/' + id,
    params: {}
  })
}

/**
 * 修改密码
 * @param id
 */
export function changePassword(data) {
  return request({
    method: 'PUT',
    url: '/api/Administrator/changePassword',
    data
  })
}
